package cz.myslivec.slovicka.dao;

import java.io.Serializable;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import cz.myslivec.slovicka.entity.TestedVocable;

@Name("testedVocableDao")
@AutoCreate
public class TestedVocableDao implements Serializable {
	private static final long serialVersionUID = -1684488882933908516L;

	@In
	private EntityManager entityManager;

	public TestedVocable get(Long id) {
		if(id == null) {
			return null;
		}
		return entityManager.find(TestedVocable.class, id);
	}

	@SuppressWarnings("unchecked")
	public List<TestedVocable> list() {
		Query query = entityManager.createQuery("from TestedVocable");
		return query.getResultList();
	}
	
	// TODO listTestVoc4Vocable
	// TODO listTestVoc4Lesson
	
}
